﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL.Project;

namespace WebApplication.User
{
    public partial class Project : System.Web.UI.Page
    {
        public int filter = 1;
        public int totalCount = 0;

        private ProjectService projectService = new ProjectService();

        public List<Models.Projects> projects = new List<Models.Projects>();

        protected void Page_Load(object sender, EventArgs e)
        {
            int queryId = Convert.ToInt32(Request.QueryString["id"]);

            string queryFilter = Request.QueryString["filter"];


            if(!string.IsNullOrEmpty(queryFilter))
            {
                filter = Convert.ToInt32(queryFilter);
            }

            if(filter == 1)
            {
                projects = projectService.GetList(ref totalCount, queryId, 1, 999, "CreatedAt Desc");

            } else
            {
                projects = projectService.GetListOfApply(ref totalCount, queryId, 1, 999, "CreatedAt Desc");

            }
        }
    }
}